var __extends =
    (this && this.__extends) ||
    (function () {
      var e = function (t, n) {
        return (e =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (e, t) {
              e.__proto__ = t;
            }) ||
          function (e, t) {
            for (var n in t)
              Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
          })(t, n);
      };
      return function (t, n) {
        function a() {
          this.constructor = t;
        }
        if ("function" != typeof n && null !== n)
          throw new TypeError(
            "Class extends value " + String(n) + " is not a constructor or null"
          );
        e(t, n),
          (t.prototype =
            null === n
              ? Object.create(n)
              : ((a.prototype = n.prototype), new a()));
      };
    })(),
  AXChangeNewNameDialog = (function (e) {
    function t() {
      var t = e.call(this) || this;
      return (
        t.btn_changeName_sure.on(
          Laya.Event.CLICK,
          t,
          t.onSureChangeNewNameAction
        ),
        WebSocketService.addListener({
          caller: t,
          code: 1908,
          method: t.onLoadChangeNameDataFn,
        }),
        t
      );
    }
    return (
      __extends(t, e),
      (t.showChangeNameDialog = function (e) {
        null == this.changeNameDialog &&
          ((this.changeNameDialog = new t()),
          (this.changeNameDialog.zOrder = 1001)),
          (this.changeNameDialog.input_changeName.text = ""),
          (this.changeNameDialog.jumpVC = ""),
          "UserInfoController" == e &&
            (this.changeNameDialog.jumpVC = "UserInfoController"),
          this.changeNameDialog.popup(!0);
      }),
      (t.prototype.onSureChangeNewNameAction = function () {
        this.input_changeName.text.length <= 0 ||
          (-1 == this.input_changeName.text.indexOf(" ")
            ? WebSocketService.send({
                c: 1908,
                d: { name: this.input_changeName.text },
              })
            : ToastView.toastView("用户名输入不能包含空格"));
      }),
      (t.prototype.onLoadChangeNameDataFn = function (e) {
        0 == e.code
          ? (ToastView.toastView(this.input_changeName.text + e.data),
            Laya.stage.event("GameMainView", {
              code: "username",
              data: this.input_changeName.text,
            }),
            (Global.roleName = this.input_changeName.text),
            "UserInfoController" != this.jumpVC &&
              WebSocketService.send({ c: 1425, d: { pageNum: 0 } }),
            this.close())
          : ToastView.toastView(e.msg);
      }),
      (t.close = function () {
        this.changeNameDialog && (this.changeNameDialog = null);
      }),
      t
    );
  })(ui.UserInfoController.AXChangeNewNameDialogUI);
